package com.zbkj.common.acpect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;

import java.util.UUID;

@Aspect
//@Component
@Slf4j
public class XXLJobHandlerAspect {

    @Pointcut("@annotation(com.xxl.job.core.handler.annotation.XxlJob)")
    public void logPointcut() {

    }

    @Before("logPointcut()")
    public void handleControllerMethod(JoinPoint point) {
        MDC.put("traceId", UUID.randomUUID().toString().replace("-", ""));
    }
}

